Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reword jsx-no-bind rationale #3581

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Reword jsx-no-bind rationale #3581

merged 1 commit into from
Jun 8, 2023

Conversation

gpoole
Copy link
Contributor

@gpoole gpoole commented May 30, 2023

I'm proposing rewording the rationale for jsx-no-bind to:

  • clarify that the performance concerns apply to specific situations; although it's qualified, the statement "is bad for performance" is a general statement and not strictly accurate
  • refer explicitly to memo since I think memoised components are probably the most common component with performance impacts from this rule
  • include the fact that this rule also covers any function declared in the render method of a component, including both anonymous or named functions, not just arrow or bound functions, as shown in the examples

Rewording the performance rationale for jsx-no-bind to clarify that the performance implications are specifically for memoized components.
@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Merging #3581 (2b2a9bb) into master (7f655f8) will increase coverage by 0.00%.
The diff coverage is n/a.

❗ Current head 2b2a9bb differs from pull request most recent head ae64aa8. Consider uploading reports for the commit ae64aa8 to get more accurate results

@@           Coverage Diff           @@
##           master    #3581   +/-   ##
=======================================
  Coverage   97.61%   97.62%           
=======================================
  Files         132      132           
  Lines        9280     9295   +15     
  Branches     3391     3400    +9     
=======================================
+ Hits         9059     9074   +15     
  Misses        221      221           

see 1 file with indirect coverage changes

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this?

Also, could we maybe add some examples as well to showcase the different kinds of functions that apply?

docs/rules/jsx-no-bind.md Outdated Show resolved Hide resolved
@gpoole
Copy link
Contributor Author

gpoole commented May 31, 2023

I've also now updated the "when not to use section" to be consistent with the rationale. Sorry for the multiple micro edits!

@ljharb ljharb merged commit ae64aa8 into jsx-eslint:master Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants